package com.jun.study.web;

import com.jun.helloapi.entity.User;
import com.jun.helloapi.service.HelloService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 描述:
 *
 * @outhor jun
 * @create 2018-04-28 11:08
 */
@RestController
public class RefactorHelloController implements HelloService {
    @Override
    public String hello(@RequestParam("name") String name) {
        return "HELLO " + name ;
    }

    @Override
    public User hello(@RequestHeader("name") String name , @RequestHeader("age") Integer age) {
        return new User (name ,age);
    }

    @Override
    public String hello(@RequestBody User user) {
        return "hello ! " + user.getName() + "," + user.getAge();
    }
}
